var roleE9S59_U = {
    run: function(creep) {
        //creep.say(creep.memory.building);
        if(creep.store.getUsedCapacity()==0){
            creep.memory.building = true;
        }
        if(creep.store.getFreeCapacity()==0){
            creep.memory.building = false;
        }

        if(creep.memory.building == true){
                //creep.say(321321);
                
                if(creep.withdraw(Game.rooms['E9S59'].lookForAt('structure',6, 20)[0], RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                        creep.moveTo(Game.rooms['E9S59'].lookForAt('structure',6, 20)[0]);
                }
        } 
        else{     
            
                        if(creep.upgradeController(creep.room.controller) == ERR_NOT_IN_RANGE) {
                            creep.moveTo(creep.room.controller);
                            //creep.say('升去');
                        }
                     
            
        }
	}
};

module.exports = roleE9S59_U;